import { ILoadMapTypeAll } from '@/common';
import { ManageCommonAPI } from '@/pages/type';
import { getLevelZeroJson, getSelectDataCommon, getSelectDataMapList, getTenantID } from '@/utils';

const getSearchList = (loadMdicMapList: Record<string, any>): ManageCommonAPI.ISearchList => {
  /** 资产分类数据字典 */
  // const materialTypeMapList = loadMdicMapList?.[`${getTenantID()}${ILoadMapTypeAll.MATERIAL_TYPE}`];
  const materialTypeMapList = getSelectDataMapList(loadMdicMapList?.[`${getTenantID()}${ILoadMapTypeAll.MATERIAL_TYPE}`], 'name', 'id', true);

  return [
    {
      name: 'assetClass',
      placeholder: '资产分类',
      label: '资产分类',
      componentType: 'TreeSelect',
      dataSource: materialTypeMapList,
      allowClear: true,
      showSearch: true,
      treeNodeFilterProp: 'name',
      md: 6,
      sm: 24,
      whetherSenior: false,
      treeID: 'id',
      treeName: 'name',
      treeChildren: 'children',
    },
  ];
};

export { getSearchList };
